package com.grandprixsw.evmsmobile;

public class Equations {
	
	float mfResult;
	EVMSProject mProject = null;

	public Equations() {
		
	}
	
	public Equations(EVMSProject pProject) {
		this.setProject(pProject);
	}
	
	public EVMSProject getProject() {
		return mProject;
	}
	
	public void setProject(EVMSProject pProject) {
		if (null != pProject)
			mProject = pProject;
	}
	
// Cost-related equations
	public float getCostVariance()
	{
		mfResult = mProject.getBCWP() - mProject.getACWP();		
		return mfResult; 
	}
	
	public float getCostVariance(EVMSProject pProject)
	{
		mfResult = pProject.getBCWP() - pProject.getACWP();		
		return mfResult; 
	}
	
	public float getCVPercentage()
	{
		mfResult = getCostVariance() /  mProject.getBCWP();		
		return mfResult; 
	}
	
	public float getCVPercentage(EVMSProject pProject)
	{
		mfResult = getCostVariance(pProject) /  pProject.getBCWP();		
		return mfResult; 
	}
	
	public float getCPI()
	{
		mfResult = mProject.getBCWP() / mProject.getACWP();		
		return mfResult; 
	}

	public float getCPI(EVMSProject pProject)
	{
		mfResult = pProject.getBCWP() / pProject.getACWP();		
		return mfResult; 
	}

/// Schedule-related equations
	public float getSchedVariance()
	{
		mfResult = mProject.getBCWP() - mProject.getBCWS();
		return mfResult;
	}

	public float getSchedVariance(EVMSProject pProject)
	{
		mfResult = pProject.getBCWP() - pProject.getBCWS();
		return mfResult;
	}

	public float getSVPercentage()
	{
		mfResult = getSchedVariance() /  mProject.getBCWS();		
		return mfResult; 
	}
		
	public float getSVPercentage(EVMSProject pProject)
	{
		mfResult = getSchedVariance(pProject) /  pProject.getBCWS();		
		return mfResult; 
	}
		
	public float getSPI()
	{
		mfResult = mProject.getBCWP() / mProject.getBCWS();		
		return mfResult; 
	}

	public float getSPI(EVMSProject pProject)
	{
		mfResult = pProject.getBCWP() / pProject.getBCWS();		
		return mfResult; 
	}

}
